class Storage {
  constructor(storage) {
    this.storage = storage;
  }
  get(key) {
    const data = this.storage.getItem(key.toUpperCase());

    return data ? JSON.parse(data) : null;
  }
  set(key, value) {
    this.storage.setItem(key.toUpperCase(), JSON.stringify(value));
  }
  remove(key) {
    if (this.get(key)) {
      this.storage.removeItem(key);
    }
  }
  clear() {
    this.storage.clear();
  }
}

const storage = new Storage(localStorage);
export default storage;
